{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# -*-coding:utf-8 -*-"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import json\n",
    "import pandas as pd\n",
    "from pandas import DataFrame, Series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "db = json.load(open(r'D:\\我的资料库\\PycharmProjects\\pydata-book-master\\ch07\\foods-2011-10-03.json'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6636"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(db)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['manufacturer', 'description', 'id', 'nutrients', 'portions', 'tags', 'group'])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "db[0].keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "nutrients = DataFrame(db[0]['nutrients'])"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>description</th>\n",
       "      <th>group</th>\n",
       "      <th>units</th>\n",
       "      <th>value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Protein</td>\n",
       "      <td>Composition</td>\n",
       "      <td>g</td>\n",
       "      <td>25.18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Total lipid (fat)</td>\n",
       "      <td>Composition</td>\n",
       "      <td>g</td>\n",
       "      <td>29.20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Carbohydrate, by difference</td>\n",
       "      <td>Composition</td>\n",
       "      <td>g</td>\n",
       "      <td>3.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Ash</td>\n",
       "      <td>Other</td>\n",
       "      <td>g</td>\n",
       "      <td>3.28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Energy</td>\n",
       "      <td>Energy</td>\n",
       "      <td>kcal</td>\n",
       "      <td>376.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Water</td>\n",
       "      <td>Composition</td>\n",
       "      <td>g</td>\n",
       "      <td>39.28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Energy</td>\n",
       "      <td>Energy</td>\n",
       "      <td>kJ</td>\n",
       "      <td>1573.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   description        group units    value\n",
       "0                      Protein  Composition     g    25.18\n",
       "1            Total lipid (fat)  Composition     g    29.20\n",
       "2  Carbohydrate, by difference  Composition     g     3.06\n",
       "3                          Ash        Other     g     3.28\n",
       "4                       Energy       Energy  kcal   376.00\n",
       "5                        Water  Composition     g    39.28\n",
       "6                       Energy       Energy    kJ  1573.00"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nutrients[:7]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "info_keys = ['description','group','id','manufacturer']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "info = DataFrame(db,columns = info_keys)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6636"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(info)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>description</th>\n",
       "      <th>group</th>\n",
       "      <th>id</th>\n",
       "      <th>manufacturer</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Cheese, caraway</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1008</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Cheese, cheddar</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1009</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Cheese, edam</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1018</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Cheese, feta</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1019</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Cheese, mozzarella, part skim milk</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1028</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          description                   group    id  \\\n",
       "0                     Cheese, caraway  Dairy and Egg Products  1008   \n",
       "1                     Cheese, cheddar  Dairy and Egg Products  1009   \n",
       "2                        Cheese, edam  Dairy and Egg Products  1018   \n",
       "3                        Cheese, feta  Dairy and Egg Products  1019   \n",
       "4  Cheese, mozzarella, part skim milk  Dairy and Egg Products  1028   \n",
       "\n",
       "  manufacturer  \n",
       "0               \n",
       "1               \n",
       "2               \n",
       "3               \n",
       "4               "
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "info[:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>description</th>\n",
       "      <th>group</th>\n",
       "      <th>id</th>\n",
       "      <th>manufacturer</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Cheese, caraway</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1008</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Cheese, cheddar</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1009</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Cheese, edam</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1018</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Cheese, feta</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1019</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Cheese, mozzarella, part skim milk</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1028</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Cheese, mozzarella, part skim milk, low moisture</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1029</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Cheese, romano</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1038</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Cheese, roquefort</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1039</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Cheese spread, pasteurized process, american, ...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1048</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Cream, fluid, half and half</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1049</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Sour dressing, non-butterfat, cultured, filled...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1058</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Milk, filled, fluid, with blend of hydrogenate...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1059</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Cream substitute, liquid, with lauric acid oil...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1068</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Cream substitute, powdered</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1069</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Milk, producer, fluid, 3.7% milkfat</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1078</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Milk, reduced fat, fluid, 2% milkfat, with add...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1079</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Milk, reduced fat, fluid, 2% milkfat, with add...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1080</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Milk, reduced fat, fluid, 2% milkfat, protein ...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1081</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Milk, lowfat, fluid, 1% milkfat, with added vi...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1082</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Milk, lowfat, fluid, 1% milkfat, with added no...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1083</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Milk, lowfat, fluid, 1% milkfat, protein forti...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1084</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Milk, nonfat, fluid, with added vitamin A and ...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1085</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Milk, nonfat, fluid, with added nonfat milk so...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1086</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Milk, nonfat, fluid, protein fortified, with a...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1087</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Milk, buttermilk, fluid, cultured, lowfat</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1088</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Milk, low sodium, fluid</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1089</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Milk, dry, whole, with added vitamin D</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1090</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Milk, dry, nonfat, regular, without added vita...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1091</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Milk, dry, nonfat, instant, with added vitamin...</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1092</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Milk, dry, nonfat, calcium reduced</td>\n",
       "      <td>Dairy and Egg Products</td>\n",
       "      <td>1093</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6606</th>\n",
       "      <td>Beef, tenderloin, steak, separable lean only, ...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23628</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6607</th>\n",
       "      <td>Beef, top sirloin, steak, separable lean only,...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23629</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6608</th>\n",
       "      <td>Beef, short loin, top loin, steak, separable l...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23630</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6609</th>\n",
       "      <td>Beef, chuck, arm pot roast, separable lean onl...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23631</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6610</th>\n",
       "      <td>Beef, brisket, flat half, separable lean only,...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23632</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6611</th>\n",
       "      <td>Beef, chuck, arm pot roast, separable lean onl...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23633</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6612</th>\n",
       "      <td>Beef, brisket, flat half, separable lean only,...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23634</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6613</th>\n",
       "      <td>Beef, round, eye of round, roast, separable le...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23635</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6614</th>\n",
       "      <td>Beef, round, top round, steak, separable lean ...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23636</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6615</th>\n",
       "      <td>Beef, round, bottom round, roast, separable le...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23637</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6616</th>\n",
       "      <td>Beef, rib, small end (ribs 10-12), separable l...</td>\n",
       "      <td>Beef Products</td>\n",
       "      <td>23638</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6617</th>\n",
       "      <td>CAMPBELL Soup Company, CAMPBELL'S Red and Whit...</td>\n",
       "      <td>Soups, Sauces, and Gravies</td>\n",
       "      <td>27015</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6618</th>\n",
       "      <td>CAMPBELL Soup Company, CAMPBELL's Red and Whit...</td>\n",
       "      <td>Soups, Sauces, and Gravies</td>\n",
       "      <td>27016</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6619</th>\n",
       "      <td>CAMPBELL Soup Company, CAMPBELL'S SELECT Soups...</td>\n",
       "      <td>Soups, Sauces, and Gravies</td>\n",
       "      <td>27021</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6620</th>\n",
       "      <td>CAMPBELL Soup Company, CAMPBELL'S SOUP AT HAND...</td>\n",
       "      <td>Soups, Sauces, and Gravies</td>\n",
       "      <td>27022</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6621</th>\n",
       "      <td>CAMPBELL Soup Company, CAMPBELL'S SOUP AT HAND...</td>\n",
       "      <td>Soups, Sauces, and Gravies</td>\n",
       "      <td>27023</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6622</th>\n",
       "      <td>CAMPBELL Soup Company, CAMPBELL'S SELECT Gold ...</td>\n",
       "      <td>Soups, Sauces, and Gravies</td>\n",
       "      <td>27024</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6623</th>\n",
       "      <td>CAMPBELL Soup Company, CAMPBELL'S SELECT Gold ...</td>\n",
       "      <td>Soups, Sauces, and Gravies</td>\n",
       "      <td>27025</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6624</th>\n",
       "      <td>CAMPBELL Soup Company, CAMPBELL'S SELECT Gold ...</td>\n",
       "      <td>Soups, Sauces, and Gravies</td>\n",
       "      <td>27026</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6625</th>\n",
       "      <td>CAMPBELL Soup Company, CAMPBELL'S Red and Whit...</td>\n",
       "      <td>Soups, Sauces, and Gravies</td>\n",
       "      <td>27032</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6626</th>\n",
       "      <td>CAMPBELL Soup Company, V8 Vegetable Juice, Ess...</td>\n",
       "      <td>Vegetables and Vegetable Products</td>\n",
       "      <td>31010</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6627</th>\n",
       "      <td>CAMPBELL Soup Company, V8 Vegetable Juice, Spi...</td>\n",
       "      <td>Vegetables and Vegetable Products</td>\n",
       "      <td>31013</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6628</th>\n",
       "      <td>CAMPBELL Soup Company, PACE, Jalapenos Nacho S...</td>\n",
       "      <td>Vegetables and Vegetable Products</td>\n",
       "      <td>31014</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6629</th>\n",
       "      <td>CAMPBELL Soup Company, V8 60% Vegetable Juice,...</td>\n",
       "      <td>Vegetables and Vegetable Products</td>\n",
       "      <td>31016</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6630</th>\n",
       "      <td>CAMPBELL Soup Company, V8 Vegetable Juice, Low...</td>\n",
       "      <td>Vegetables and Vegetable Products</td>\n",
       "      <td>31017</td>\n",
       "      <td>Campbell Soup Co.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6631</th>\n",
       "      <td>Bologna, beef, low fat</td>\n",
       "      <td>Sausages and Luncheon Meats</td>\n",
       "      <td>42161</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6632</th>\n",
       "      <td>Turkey and pork sausage, fresh, bulk, patty or...</td>\n",
       "      <td>Sausages and Luncheon Meats</td>\n",
       "      <td>42173</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6633</th>\n",
       "      <td>Babyfood, juice, pear</td>\n",
       "      <td>Baby Foods</td>\n",
       "      <td>43408</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6634</th>\n",
       "      <td>Babyfood, dessert, banana yogurt, strained</td>\n",
       "      <td>Baby Foods</td>\n",
       "      <td>43539</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6635</th>\n",
       "      <td>Babyfood, banana no tapioca, strained</td>\n",
       "      <td>Baby Foods</td>\n",
       "      <td>43546</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>6636 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                            description  \\\n",
       "0                                       Cheese, caraway   \n",
       "1                                       Cheese, cheddar   \n",
       "2                                          Cheese, edam   \n",
       "3                                          Cheese, feta   \n",
       "4                    Cheese, mozzarella, part skim milk   \n",
       "5      Cheese, mozzarella, part skim milk, low moisture   \n",
       "6                                        Cheese, romano   \n",
       "7                                     Cheese, roquefort   \n",
       "8     Cheese spread, pasteurized process, american, ...   \n",
       "9                           Cream, fluid, half and half   \n",
       "10    Sour dressing, non-butterfat, cultured, filled...   \n",
       "11    Milk, filled, fluid, with blend of hydrogenate...   \n",
       "12    Cream substitute, liquid, with lauric acid oil...   \n",
       "13                           Cream substitute, powdered   \n",
       "14                  Milk, producer, fluid, 3.7% milkfat   \n",
       "15    Milk, reduced fat, fluid, 2% milkfat, with add...   \n",
       "16    Milk, reduced fat, fluid, 2% milkfat, with add...   \n",
       "17    Milk, reduced fat, fluid, 2% milkfat, protein ...   \n",
       "18    Milk, lowfat, fluid, 1% milkfat, with added vi...   \n",
       "19    Milk, lowfat, fluid, 1% milkfat, with added no...   \n",
       "20    Milk, lowfat, fluid, 1% milkfat, protein forti...   \n",
       "21    Milk, nonfat, fluid, with added vitamin A and ...   \n",
       "22    Milk, nonfat, fluid, with added nonfat milk so...   \n",
       "23    Milk, nonfat, fluid, protein fortified, with a...   \n",
       "24            Milk, buttermilk, fluid, cultured, lowfat   \n",
       "25                              Milk, low sodium, fluid   \n",
       "26               Milk, dry, whole, with added vitamin D   \n",
       "27    Milk, dry, nonfat, regular, without added vita...   \n",
       "28    Milk, dry, nonfat, instant, with added vitamin...   \n",
       "29                   Milk, dry, nonfat, calcium reduced   \n",
       "...                                                 ...   \n",
       "6606  Beef, tenderloin, steak, separable lean only, ...   \n",
       "6607  Beef, top sirloin, steak, separable lean only,...   \n",
       "6608  Beef, short loin, top loin, steak, separable l...   \n",
       "6609  Beef, chuck, arm pot roast, separable lean onl...   \n",
       "6610  Beef, brisket, flat half, separable lean only,...   \n",
       "6611  Beef, chuck, arm pot roast, separable lean onl...   \n",
       "6612  Beef, brisket, flat half, separable lean only,...   \n",
       "6613  Beef, round, eye of round, roast, separable le...   \n",
       "6614  Beef, round, top round, steak, separable lean ...   \n",
       "6615  Beef, round, bottom round, roast, separable le...   \n",
       "6616  Beef, rib, small end (ribs 10-12), separable l...   \n",
       "6617  CAMPBELL Soup Company, CAMPBELL'S Red and Whit...   \n",
       "6618  CAMPBELL Soup Company, CAMPBELL's Red and Whit...   \n",
       "6619  CAMPBELL Soup Company, CAMPBELL'S SELECT Soups...   \n",
       "6620  CAMPBELL Soup Company, CAMPBELL'S SOUP AT HAND...   \n",
       "6621  CAMPBELL Soup Company, CAMPBELL'S SOUP AT HAND...   \n",
       "6622  CAMPBELL Soup Company, CAMPBELL'S SELECT Gold ...   \n",
       "6623  CAMPBELL Soup Company, CAMPBELL'S SELECT Gold ...   \n",
       "6624  CAMPBELL Soup Company, CAMPBELL'S SELECT Gold ...   \n",
       "6625  CAMPBELL Soup Company, CAMPBELL'S Red and Whit...   \n",
       "6626  CAMPBELL Soup Company, V8 Vegetable Juice, Ess...   \n",
       "6627  CAMPBELL Soup Company, V8 Vegetable Juice, Spi...   \n",
       "6628  CAMPBELL Soup Company, PACE, Jalapenos Nacho S...   \n",
       "6629  CAMPBELL Soup Company, V8 60% Vegetable Juice,...   \n",
       "6630  CAMPBELL Soup Company, V8 Vegetable Juice, Low...   \n",
       "6631                             Bologna, beef, low fat   \n",
       "6632  Turkey and pork sausage, fresh, bulk, patty or...   \n",
       "6633                              Babyfood, juice, pear   \n",
       "6634         Babyfood, dessert, banana yogurt, strained   \n",
       "6635              Babyfood, banana no tapioca, strained   \n",
       "\n",
       "                                  group     id       manufacturer  \n",
       "0                Dairy and Egg Products   1008                     \n",
       "1                Dairy and Egg Products   1009                     \n",
       "2                Dairy and Egg Products   1018                     \n",
       "3                Dairy and Egg Products   1019                     \n",
       "4                Dairy and Egg Products   1028                     \n",
       "5                Dairy and Egg Products   1029                     \n",
       "6                Dairy and Egg Products   1038                     \n",
       "7                Dairy and Egg Products   1039                     \n",
       "8                Dairy and Egg Products   1048                     \n",
       "9                Dairy and Egg Products   1049                     \n",
       "10               Dairy and Egg Products   1058                     \n",
       "11               Dairy and Egg Products   1059                     \n",
       "12               Dairy and Egg Products   1068                     \n",
       "13               Dairy and Egg Products   1069                     \n",
       "14               Dairy and Egg Products   1078                     \n",
       "15               Dairy and Egg Products   1079               None  \n",
       "16               Dairy and Egg Products   1080                     \n",
       "17               Dairy and Egg Products   1081                     \n",
       "18               Dairy and Egg Products   1082                     \n",
       "19               Dairy and Egg Products   1083                     \n",
       "20               Dairy and Egg Products   1084                     \n",
       "21               Dairy and Egg Products   1085                     \n",
       "22               Dairy and Egg Products   1086                     \n",
       "23               Dairy and Egg Products   1087                     \n",
       "24               Dairy and Egg Products   1088                     \n",
       "25               Dairy and Egg Products   1089                     \n",
       "26               Dairy and Egg Products   1090                     \n",
       "27               Dairy and Egg Products   1091                     \n",
       "28               Dairy and Egg Products   1092                     \n",
       "29               Dairy and Egg Products   1093                     \n",
       "...                                 ...    ...                ...  \n",
       "6606                      Beef Products  23628                     \n",
       "6607                      Beef Products  23629                     \n",
       "6608                      Beef Products  23630                     \n",
       "6609                      Beef Products  23631                     \n",
       "6610                      Beef Products  23632                     \n",
       "6611                      Beef Products  23633                     \n",
       "6612                      Beef Products  23634                     \n",
       "6613                      Beef Products  23635                     \n",
       "6614                      Beef Products  23636                     \n",
       "6615                      Beef Products  23637                     \n",
       "6616                      Beef Products  23638                     \n",
       "6617         Soups, Sauces, and Gravies  27015  Campbell Soup Co.  \n",
       "6618         Soups, Sauces, and Gravies  27016  Campbell Soup Co.  \n",
       "6619         Soups, Sauces, and Gravies  27021  Campbell Soup Co.  \n",
       "6620         Soups, Sauces, and Gravies  27022  Campbell Soup Co.  \n",
       "6621         Soups, Sauces, and Gravies  27023  Campbell Soup Co.  \n",
       "6622         Soups, Sauces, and Gravies  27024  Campbell Soup Co.  \n",
       "6623         Soups, Sauces, and Gravies  27025  Campbell Soup Co.  \n",
       "6624         Soups, Sauces, and Gravies  27026  Campbell Soup Co.  \n",
       "6625         Soups, Sauces, and Gravies  27032  Campbell Soup Co.  \n",
       "6626  Vegetables and Vegetable Products  31010  Campbell Soup Co.  \n",
       "6627  Vegetables and Vegetable Products  31013  Campbell Soup Co.  \n",
       "6628  Vegetables and Vegetable Products  31014  Campbell Soup Co.  \n",
       "6629  Vegetables and Vegetable Products  31016  Campbell Soup Co.  \n",
       "6630  Vegetables and Vegetable Products  31017  Campbell Soup Co.  \n",
       "6631        Sausages and Luncheon Meats  42161                     \n",
       "6632        Sausages and Luncheon Meats  42173                     \n",
       "6633                         Baby Foods  43408               None  \n",
       "6634                         Baby Foods  43539               None  \n",
       "6635                         Baby Foods  43546               None  \n",
       "\n",
       "[6636 rows x 4 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Vegetables and Vegetable Products    812\n",
       "Beef Products                        618\n",
       "Baked Products                       496\n",
       "Breakfast Cereals                    403\n",
       "Legumes and Legume Products          365\n",
       "Fast Foods                           365\n",
       "Lamb, Veal, and Game Products        345\n",
       "Sweets                               341\n",
       "Pork Products                        328\n",
       "Fruits and Fruit Juices              328\n",
       "dtype: int64"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.value_counts(info.group)[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
